home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / accevl / main.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-06  |  4.3 KB  |  145 lines

  1. VERSION 2.00
  2. Begin Form frmMain 
  3.    Caption         =   "Using Access Engine as Expression Evaluator"
  4.    ClientHeight    =   4725
  5.    ClientLeft      =   825
  6.    ClientTop       =   1470
  7.    ClientWidth     =   7275
  8.    Height          =   5130
  9.    Left            =   765
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4725
  12.    ScaleWidth      =   7275
  13.    Top             =   1125
  14.    Width           =   7395
  15.    Begin TextBox txtResult 
  16.       Height          =   1695
  17.       Left            =   3420
  18.       MultiLine       =   -1  'True
  19.       ScrollBars      =   2  'Vertical
  20.       TabIndex        =   6
  21.       Top             =   1740
  22.       Width           =   3645
  23.    End
  24.    Begin CommandButton cmdExit 
  25.       Caption         =   "E&xit"
  26.       Height          =   615
  27.       Left            =   5970
  28.       TabIndex        =   4
  29.       Top             =   3900
  30.       Width           =   1095
  31.    End
  32.    Begin PictureBox CMDialog1 
  33.       Height          =   480
  34.       Left            =   4590
  35.       ScaleHeight     =   450
  36.       ScaleWidth      =   1170
  37.       TabIndex        =   7
  38.       Top             =   3900
  39.       Width           =   1200
  40.    End
  41.    Begin CommandButton cmdOpen 
  42.       Caption         =   "&Open Access Database"
  43.       Height          =   615
  44.       Left            =   150
  45.       TabIndex        =   3
  46.       Top             =   3900
  47.       Width           =   2265
  48.    End
  49.    Begin CommandButton cmdEvaluate 
  50.       Caption         =   "E&valuate"
  51.       Enabled         =   0   'False
  52.       Height          =   765
  53.       Left            =   600
  54.       TabIndex        =   2
  55.       Top             =   2190
  56.       Width           =   1545
  57.    End
  58.    Begin TextBox txtExpression 
  59.       Height          =   765
  60.       Left            =   150
  61.       MultiLine       =   -1  'True
  62.       TabIndex        =   0
  63.       Text            =   "log(cos(90)+sin(90))"
  64.       Top             =   780
  65.       Width           =   6885
  66.    End
  67.    Begin Data Data1 
  68.       Caption         =   "Data1"
  69.       Connect         =   ""
  70.       DatabaseName    =   ""
  71.       Exclusive       =   0   'False
  72.       Height          =   585
  73.       Left            =   2610
  74.       Options         =   0
  75.       ReadOnly        =   0   'False
  76.       RecordSource    =   ""
  77.       Top             =   3900
  78.       Visible         =   0   'False
  79.       Width           =   1785
  80.    End
  81.    Begin Label Label1 
  82.       Caption         =   "Enter Expression below, then click on Evaluate button."
  83.       Height          =   285
  84.       Index           =   1
  85.       Left            =   150
  86.       TabIndex        =   5
  87.       Top             =   450
  88.       Width           =   6915
  89.    End
  90.    Begin Line Line1 
  91.       X1              =   120
  92.       X2              =   7050
  93.       Y1              =   3660
  94.       Y2              =   3660
  95.    End
  96.    Begin Image Image2 
  97.       Height          =   480
  98.       Left            =   2400
  99.       Picture         =   MAIN.FRX:0000
  100.       Top             =   2280
  101.       Width           =   480
  102.    End
  103.    Begin Image Image1 
  104.       Height          =   480
  105.       Left            =   1200
  106.       Picture         =   MAIN.FRX:0302
  107.       Top             =   1620
  108.       Width           =   480
  109.    End
  110.    Begin Label Label1 
  111.       Caption         =   "Click on ""Open Access Database"" button and select ACCEVL11.MDB."
  112.       Height          =   255
  113.       Index           =   0
  114.       Left            =   150
  115.       TabIndex        =   1
  116.       Top             =   120
  117.       Width           =   6885
  118.    End
  119. Option Explicit
  120. Sub cmdEvaluate_Click ()
  121.     Dim sCmd As String
  122.     On Error GoTo ErrorHandlerCommand1_Click
  123.     sCmd = "select " + txtExpression.Text + " as MyEval From DummyForEval"
  124.     Data1.RecordSource = sCmd
  125.     Data1.Refresh
  126.     txtResult.Text = txtResult.Text + Format(Data1.Recordset(0), "") + Chr(13) + Chr(10)
  127.     Exit Sub
  128. ErrorHandlerCommand1_Click:
  129.     MsgBox Error
  130.     MsgBox "Unable to evaluate expression"
  131.     Exit Sub
  132. End Sub
  133. Sub cmdExit_Click ()
  134.     End
  135. End Sub
  136. Sub cmdOpen_Click ()
  137.     On Error GoTo ErrorHandlercmdOpen_Click
  138.     CMDialog1.Action = 1
  139.     Data1.DatabaseName = CMDialog1.Filename
  140.     cmdEvaluate.Enabled = True
  141.     Exit Sub
  142. ErrorHandlercmdOpen_Click:
  143.     Exit Sub
  144. End Sub
  145.